package com.chinasofti.project.web.form;

import java.util.Date;

import javax.validation.constraints.Pattern;

import org.hibernate.validator.constraints.Email;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotBlank;

import com.chinasofti.project.common.web.BaseForm;
import com.chinasofti.project.exceptions.ValidationException;

public class UserForm extends BaseForm{
	private int userId;

    private String userNickname;//用户昵称
    
    @NotBlank(message="密码不能为空")
    @Length(min=6,max=16,message="密码的长度应该在{min}与{max}之间")
    private String userPassword;//用户密码
    
    @NotBlank(message="确认密码不能为空")//确认用户的密码
    private String rePassword;
    
    @NotBlank(message="邮箱不能为空")
    @Email(message="邮箱格式不正确")
    private String userEmail;//用户邮箱

	@NotBlank(message = "邮箱不能为空")
    @Pattern (  regexp = "^\\d{11}$", message="手机格式不是11位" )
    private String userPhone;//用户手机号

    private Date userRegisterDate;//用户注册时间

    private Date lastUpdateDate;//用户最后一次更新时间

    private double userBalance;//用户余额

    private int userState;//用户状态 0为允许登录1为禁止登录
    @Length(min=1,max=6,message="用户性别长度应该在{min}与{max}之间")
    private String userSex;//用户性别
    
    private int userIntegral;//用户积分
    @Length(min=6,max=18,message="用户性别长度应该在{min}与{max}之间")
    private String userPayPassword;//用户支付密码
    
    private Date userBirthday;//用户生日

    private int userVipGrand;//用户会员等级

    private Date userLastLogintime;//用户上次登录时间

    private Date userNowLogintime;//用户本次登录时间
    @Length(min=1,max=40,message="用户性别长度应该在{min}与{max}之间")
    private String userTrueName;//用户姓名
    
    @Override
    protected void validateMore() {
    	if(!userPassword.equals(rePassword)){
    		throw new ValidationException("userPassword","两次输入的密码不相同");
    	}
    }

	public int getUserId() {
		return userId;
	}

	public void setUserId(int userId) {
		this.userId = userId;
	}

	public String getUserNickname() {
		return userNickname;
	}

	public void setUserNickname(String userNickname) {
		this.userNickname = userNickname;
	}

	public String getUserPassword() {
		return userPassword;
	}

	public void setUserPassword(String userPassword) {
		this.userPassword = userPassword;
	}

	public String getRePassword() {
		return rePassword;
	}

	public void setRePassword(String rePassword) {
		this.rePassword = rePassword;
	}

	public String getUserEmail() {
		return userEmail;
	}

	public void setUserEmail(String userEmail) {
		this.userEmail = userEmail;
	}

	public String getUserPhone() {
		return userPhone;
	}

	public void setUserPhone(String userPhone) {
		this.userPhone = userPhone;
	}

	public Date getUserRegisterDate() {
		return userRegisterDate;
	}

	public void setUserRegisterDate(Date userRegisterDate) {
		this.userRegisterDate = userRegisterDate;
	}

	public Date getLastUpdateDate() {
		return lastUpdateDate;
	}

	public void setLastUpdateDate(Date lastUpdateDate) {
		this.lastUpdateDate = lastUpdateDate;
	}

	public double getUserBalance() {
		return userBalance;
	}

	public void setUserBalance(double userBalance) {
		this.userBalance = userBalance;
	}

	public int getUserState() {
		return userState;
	}

	public void setUserState(int userState) {
		this.userState = userState;
	}

	public String getUserSex() {
		return userSex;
	}

	public void setUserSex(String userSex) {
		this.userSex = userSex;
	}

	public int getUserIntegral() {
		return userIntegral;
	}

	public void setUserIntegral(int userIntegral) {
		this.userIntegral = userIntegral;
	}

	public String getUserPayPassword() {
		return userPayPassword;
	}

	public void setUserPayPassword(String userPayPassword) {
		this.userPayPassword = userPayPassword;
	}

	public Date getUserBirthday() {
		return userBirthday;
	}

	public void setUserBirthday(Date userBirthday) {
		this.userBirthday = userBirthday;
	}

	public int getUserVipGrand() {
		return userVipGrand;
	}

	public void setUserVipGrand(int userVipGrand) {
		this.userVipGrand = userVipGrand;
	}

	public Date getUserLastLogintime() {
		return userLastLogintime;
	}

	public void setUserLastLogintime(Date userLastLogintime) {
		this.userLastLogintime = userLastLogintime;
	}

	public Date getUserNowLogintime() {
		return userNowLogintime;
	}

	public void setUserNowLogintime(Date userNowLogintime) {
		this.userNowLogintime = userNowLogintime;
	}

	public String getUserTrueName() {
		return userTrueName;
	}

	public void setUserTrueName(String userTrueName) {
		this.userTrueName = userTrueName;
	}

    
    

}